package com.adcage.ojudgebackendjudgeservice.judge.codeSandbox;


import com.adcage.ojudgebackendjudgeservice.judge.codeSandbox.Impl.ExampleCodeSandbox;
import com.adcage.ojudgebackendjudgeservice.judge.codeSandbox.Impl.RemoteCodeSandbox;
import com.adcage.ojudgebackendjudgeservice.judge.codeSandbox.Impl.ThirdPartyCodeSandbox;

/**
 * 代码沙箱工厂
 */
public class CodeSandBoxFactory {
    /**
     * 根据传入的参数获取对应的代码沙箱实例
     *
     * @param type
     * @return
     */
    public static CodeSandbox newInstance(String type) {
        if (type.equals("example")) {
            return new ExampleCodeSandbox();
        } else if (type.equals("remote")) {
            return new RemoteCodeSandbox();
        } else if (type.equals("thirdParty")) {
            return new ThirdPartyCodeSandbox();
        } else {
            return new RemoteCodeSandbox();
        }
    }
}
